fix: use Millisecond instead of Nanosecond for retry delay in cacheVersion#127
Open
Nepomuk5665 wants to merge 1 commit into
Open
fix: use Millisecond instead of Nanosecond for retry delay in cacheVersion#127Nepomuk5665 wants to merge 1 commit into
Nepomuk5665 wants to merge 1 commit into
Conversation
Contributor
|
Thanks for the bug fix. I'm tempted to turn these into aws-secretsmanager-caching-go/secretcache/cacheObject.go Lines 22 to 25 in 8bf0ef6 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #127 +/- ##
=======================================
Coverage 95.80% 95.80%
=======================================
Files 7 7
Lines 286 286
=======================================
Hits 274 274
Misses 10 10
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a time unit bug in
cacheVersion.gowheretime.Nanosecondwas used instead oftime.Millisecondfor calculating retry delay duration.The Bug
In
secretcache/cacheVersion.goline 58, the retry delay calculation uses the wrong time unit:This should use
time.Millisecondto be consistent with the identical retry logic insecretcache/cacheItem.goline 162:Impact
The retry delay is 1,000,000x shorter than intended. For example, with
exceptionRetryDelayBase = 1(1ms), the actual delay becomes 1 nanosecond instead of 1 millisecond. This effectively eliminates the exponential backoff mechanism, causing:Fix
Change
time.Nanosecondtotime.MillisecondincacheVersion.goto match the correct implementation incacheItem.go.